package com.serviceprovider.business.module.admin.messages.model;

//~--- non-JDK imports --------------------------------------------------------

import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;

public class Message {
    private boolean active;
    private String  expiryDate;
    private int     id;
    @NotBlank
    private String  messageText;
    private int     roleId;
    private int     userId;

    @Override
    public boolean equals(Object obj) {
        if ((obj == null) ||!(obj instanceof Message)) {
            return false;
        }

        Message b  = (Message) obj;
        boolean eq = (id == b.id);

        if (!eq) {
            return false;
        }

        eq = (roleId == b.roleId);

        if (!eq) {
            return false;
        }

        eq = (userId == b.userId);

        if (!eq) {
            return false;
        }

        eq = ((expiryDate == null) && (b.expiryDate == null))
             || ((expiryDate != null) && expiryDate.equals(b.expiryDate));

        if (!eq) {
            return false;
        }

        eq = (active == b.active);

        if (!eq) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int prime  = 31;
        int result = 1;

        result = prime * result + id;
        result = prime * result + roleId;
        result = prime * result + userId;
        result = prime * result + ((expiryDate == null)
                                   ? 0
                                   : expiryDate.hashCode());
        result = prime * result + ((active == false)
                                   ? 0
                                   : 1);

        return result;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public String getMessageText() {
        return messageText;
    }

    public void setMessageText(String messageText) {
        this.messageText = messageText;
    }
}



